package com.sx.yqxt.pojo.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import java.time.LocalDateTime;
import java.io.Serializable;

import com.sx.yqxt.pojo.bo.MTRBo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

/**
 * <p>
 * 
 * </p>
 *
 * @author ${author}
 * @since 2022-06-13
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = false)
public class Record extends BaseEntity implements Serializable {

    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    /**
     * 累计确诊
     */
    private Integer confirm;

    /**
     * 疑似
     */
    private Integer suspect;

    /**
     * 累计治愈
     */
    private Integer heal;

    /**
     * 累计死亡
     */
    private Integer dead;

    /**
     * 严重的
     */
    private Integer severe;

    private Integer storeConfirm;

    /**
     * 境外输入
     */
    private Integer input;

    /**
     * 无症状感染者
     */
    private Integer noSymptom;

    /**
     *
     */
    private Integer incrNoSymptom;

    /**
     * 日期
     */
    private String date;

    /**
     * 地区名
     */
    private String name;

    /**
     * 父id
     */
    private Long pid;

    /**
     * 类型(2是chinaTotalData;1是chinaDayList;0是areaTree
     */
    private Integer type;


    public Record(MTRBo mtrBo,Integer type){
        this.type = type;
        this.date = mtrBo.getDate();
        this.name = mtrBo.getName();
        if(mtrBo.getExtData()!=null){
            this.noSymptom = mtrBo.getExtData().getNoSymptom();
            this.incrNoSymptom = mtrBo.getExtData().getIncrNoSymptom();
        }

        if(type==1&&mtrBo.getToday()!=null){
            this.confirm = mtrBo.getToday().getConfirm();
            this.storeConfirm = mtrBo.getToday().getStoreConfirm();
            this.input = mtrBo.getToday().getInput();
            this.severe = mtrBo.getToday().getSevere();
            this.heal = mtrBo.getToday().getHeal();
            this.dead = mtrBo.getToday().getDead();
            this.suspect = mtrBo.getToday().getSuspect();
        }else {
            this.confirm = mtrBo.getTotal().getConfirm();
            this.storeConfirm = mtrBo.getTotal().getStoreConfirm();
            this.input = mtrBo.getTotal().getInput();
            this.severe = mtrBo.getTotal().getSevere();
            this.heal = mtrBo.getTotal().getHeal();
            this.dead = mtrBo.getTotal().getDead();
            this.suspect = mtrBo.getTotal().getSuspect();
        }
        if(mtrBo.getPid()!=null&&mtrBo.getPid()!=0){
            this.pid = mtrBo.getPid();
        }else {
            this.pid = 0L;
        }
    }

}
